package com.ruoyi.project.wenyanwen.sentence.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.wenyanwen.sentence.domain.Sentence;
import com.ruoyi.project.wenyanwen.sentence.mapper.SentenceMapper;
import com.ruoyi.project.wenyanwen.sentence.service.ISentenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 诗词名句Service业务层处理
 *
 * @author shixiangwen
 * @date 2020-08-05
 */
@Service
@DataSource(value = DataSourceType.KKWENYANWEN)
public class SentenceServiceImpl implements ISentenceService {

    @Autowired
    private SentenceMapper sentenceMapper;

    /**
     * 查询诗词名句
     *
     * @param id 诗词名句ID
     * @return 诗词名句
     */
    @Override
    public Sentence selectSentenceById(Long id) {
        return sentenceMapper.selectSentenceById(id);
    }

    /**
     * 查询诗词名句列表
     *
     * @param sentence 诗词名句
     * @return 诗词名句
     */
    @Override
    public List<Sentence> selectSentenceList(Sentence sentence) {
        return sentenceMapper.selectSentenceList(sentence);
    }

    /**
     * 新增诗词名句
     *
     * @param sentence 诗词名句
     * @return 结果
     */
    @Override
    public int insertSentence(Sentence sentence) {
        return sentenceMapper.insertSentence(sentence);
    }

    /**
     * 修改诗词名句
     *
     * @param sentence 诗词名句
     * @return 结果
     */
    @Override
    public int updateSentence(Sentence sentence) {
        return sentenceMapper.updateSentence(sentence);
    }

    /**
     * 删除诗词名句对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSentenceByIds(String ids) {
        return sentenceMapper.deleteSentenceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除诗词名句信息
     *
     * @param id 诗词名句ID
     * @return 结果
     */
    @Override
    public int deleteSentenceById(Long id) {
        return sentenceMapper.deleteSentenceById(id);
    }
}
